using System;
using System.Data;
using System.Collections;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Web.Core;
using Web.Core.Providers;

/// <summary>
/// Summary description for Categories
/// </summary>
namespace Web.Core.Objects
{
    public class Categories
    {
        public static ArrayList arr = new ArrayList();

        public Categories()
        {
        }
        public static ArrayList GetAllCategories(int language, int pageNumber, int pageSize)
        {
            return DataProvider.GetInstance().GetAllCategories(language, pageNumber, pageSize);
        }
        public static ArrayList GetCategories(int lang)
        {
            return DataProvider.GetInstance().GetCategories(0, "", "", 0, lang,1);
        }

        public static ArrayList GetParentCategories(int lang)
        {
            return DataProvider.GetInstance().GetCategories(0, "", "", 0, lang, 0);
        }

        public static ArrayList GetChild(int parentID, int lang)
        {
            return DataProvider.GetInstance().GetAllChild(parentID, lang);
        }

        public static Category GetCategoryByID(int catID, int lang)
        {
            return (Category)DataProvider.GetInstance().GetCategories(catID, "", "", 0, lang,1)[0];
        }

        public static ArrayList GetCategoriesByQuantity(int quantity, int lang)
        {
            return DataProvider.GetInstance().GetCategoriesByQuantity(quantity, lang);
        }

        public static int CountAllCategories(int lang)
        {
            return DataProvider.GetInstance().CountCategories("", "", 0, lang);
        }
        public static int InsertCategory(Category cat, ShopContent lang)
        {
            return DataProvider.GetInstance().CreateUpdateDeleteCategories(cat, lang, GlobalStorage.Action.Insert);
        }

        public static int UpdateCategory(Category cat, ShopContent lang)
        {
            return DataProvider.GetInstance().CreateUpdateDeleteCategories(cat, lang, GlobalStorage.Action.Update);
        }

        public static int DeleteCategory(Category cat)
        {
            return DataProvider.GetInstance().CreateUpdateDeleteCategories(cat, new ShopContent("", "", "", ""), GlobalStorage.Action.Delete);
        }

        public static ArrayList GetTop(int lang)
        {
            return DataProvider.GetInstance().GetTop(lang);
        }

        public static ArrayList getByManu(int manu, int lang)
        {
            return DataProvider.GetInstance().GetAllCategoriesByManufact(manu, lang);
        }
    }
}
